@*
    For more information on enabling MVC for empty projects, visit https://go.microsoft.com/fwlink/?LinkID=397860
*@
@model Abc.Application.EmailSettingDto
@{
}
<form class="layui-form" action="" onsubmit="return false">
    <div class="layui-form-item">
        <label class="layui-form-label">SMTP服务器</label>
        <div class="layui-input-block">
            <input type="text" asp-for="EmailSmtpHost" required lay-verify="required" placeholder="请输入SMTP服务器" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">邮件服务器Smtp端口</label>
        <div class="layui-input-block">
            <input type="text" asp-for="EmailSmtpPort" required lay-verify="required" placeholder="请输入邮件服务器Smtp端口" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">EmailUser</label>
        <div class="layui-input-block">
            <input type="text" asp-for="EmailUser" required lay-verify="required" placeholder="请输入EmailUser" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">EmailPassword</label>
        <div class="layui-input-block">
            <input type="text" asp-for="EmailPassword" required lay-verify="required" placeholder="请输入EmailPassword" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">发送邮件来源</label>
        <div class="layui-input-block">
            <input type="text" asp-for="EmailFrom" required lay-verify="required" placeholder="请输入发送邮件来源" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否包含Html代码</label>
        <div class="layui-input-block">
            <input type="checkbox" id="EmailIsHtml" asp-for="EmailIsHtml" lay-skin="switch" lay-text="开|关">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">发送者显示名</label>
        <div class="layui-input-block">
            <input type="text" asp-for="EmailDisplayName" required lay-verify="required" placeholder="请输入发送者显示名" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">是否启用SSL加密</label>
        <div class="layui-input-block">
            <input type="checkbox" id="EmailEnableSsl" asp-for="EmailEnableSsl" lay-skin="switch" lay-text="开|关">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>
</form>

@section scripts{
    <script>
        layui.use(['jquery', 'form'], function () {
            var $ = layui.jquery;
        var form = layui.form;
        var element = layui.element;
        form.on('submit(formDemo)', function (obj) {
            obj.field.EmailIsHtml = $('#EmailIsHtml').is(':checked');
            obj.field.EmailEnableSsl = $('#EmailEnableSsl').is(':checked');
           /* form.on('submit(formDemo)', function (data) {*/
            // layer.msg(JSON.stringify(data.field));
            app.post({url:"@(Url.Action("EmailSetting"))",data:obj.field})
            return false;
        });
    });
    </script>
}